<%@ include file="/pages/taglibs.jsp"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" scope="request" />
<head>
	<title>Monitorar Perimetro</title>
	<script type="text/javascript" src="${ctx}/scripts/selects.js"></script>
	
	<script type="text/javascript" language="javascript">
			function submeter(){
				var cercaId = document.getElementById('cercaId').value;
				
				if (cercaId != '') {
					var url = '${ctx}/monitorCercaVeiculoAction.do?method=consultar&cercaId=';
					url += ''+cercaId;

					window.open(url, 'monitorarCercaIframe');	

					document.getElementById('iframe').style.display = 'block';
				} else {
				
					alert('Selecione uma cerca.');
				
				}
				
			}
	</script>
	
</head>

<html:form action="/monitorCercaVeiculoAction">
	<html:hidden property="method" value="consultar" />
	<fieldset id="fieldset-mv">
		<legend><bean:message key="command.options" /></legend>
		<div class="campoSelecao">
			<label for="cercaId">Perimetro:</label><br />
			<html:select styleId="cercaId" property="cercaId">
				<html:option value="">selecione um perimetro</html:option>
				<c:forEach items="${cercas}" var="cerca">
					<html:option value="${cerca.id}">${cerca.codigo} - ${cerca.descricao}</html:option>
				</c:forEach>
			</html:select>
		</div>
		<div class="campoBotao">
			<button id="monitorar" type="button" onclick="javascript: submeter();">Monitorar Perimetro</button>
		</div>
	</fieldset>
</html:form>	
<br>

<div id="iframe" style="display: none">
	<IFRAME id="monitorarCercaIframe" name="monitorarCercaIframe" src="about:blank" scrolling="none"></IFRAME>
</div>

	

	